package com.ibm.cloud.banking.account.service;

import com.alipay.sofa.runtime.api.annotation.SofaService;
import com.alipay.sofa.runtime.api.annotation.SofaServiceBinding;
import com.ibm.cloud.banking.facade.main.PcsFacade;
import com.ibm.cloud.banking.platform.context.service.RequestContextHandler;
import com.ibm.cloud.banking.platform.message.Request;
import org.apache.camel.CamelContext;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author cmk
 * @date 2022/8/5
 */
@Service
@SofaService(interfaceType = PcsFacade.class, bindings = { @SofaServiceBinding(bindingType = "bolt") })
public class PcsServiceImpl implements PcsFacade {
    @Resource
    CamelContext context;
    @Override
    public Object service(Request request) {
        return this.context.createFluentProducerTemplate().to("direct:" +request.getReqHeader().getOtsCod()).withHeader("reqHeader", request.getReqHeader()).withBody(request.getReqBody()).request();
    }
}
